import request from '../utils/request'

export function queryAllType() {
  return request({
    url: '/type/queryAllType',
    method: 'get',
    params: {}
  })
}

// 查询分类列表
//Integer page 页数
//Integer size 大小
export function queryAllTypeByLimit(query) {
  return request({
    url: '/type/queryAllByLimit',
    method: 'get',
    params: query
  })
}

// 新增分类
export function saveType(data) {
  return request({
    url: '/type/saveType',
    method: 'post',
    data: data
  })
}

// 更新分类
export function updateType(type) {
  return request({
    url: '/type/updateType',
    method: 'post',
    data: type
  })
}

// 删除分类
export function deleteTypeById(typeId) {
  return request({
    url: '/type/deleteTypeById',
    method: 'get',
    params: typeId
  })
}

export function getTypeByName(name) {
  let data = {
    name
  }
  return request({
    url: '/type/getTypeByName',
    method: 'get',
    params: data
  })
}
